/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Dao;



import Util.ConSQL;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Vector;
import javax.swing.JComboBox;
import javax.swing.JTable;

/**
 *
 * @author use
 */
public class QuanliLopHocphan {
    ConSQL cs = new ConSQL();
    //khoi tao cac cbb
    public void cbbMakhoa(JComboBox cbb) throws Exception{
        cbb.removeAllItems();
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select makhoa from khoa");
        
        while(rs.next()){
            cbb.addItem(rs.getString(1));
        }
    }
    public void cbbtenkhoa(JComboBox cbb) throws Exception{
        cbb.removeAllItems();
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select tenkhoa from khoa");
        
        while(rs.next()){
            cbb.addItem(rs.getString(1));
        }
    }
    public void cbbMaMon(JComboBox cbb) throws Exception{
        cbb.removeAllItems();
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select maMH from monHoc");
        
        while(rs.next()){
            cbb.addItem(rs.getString(1));
        }
    }
    public void cbbGiaoVien(JComboBox cbb) throws SQLException{
        cbb.removeAllItems();
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select maGV from giaoVien");
        while(rs.next()){
            cbb.addItem(rs.getString(1));
        }
    }
    public void cbbtenMon(JComboBox cbb) throws Exception{
        cbb.removeAllItems();
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select tenMH from monHoc");
        
        while(rs.next()){
            cbb.addItem(rs.getString(1));
        }
    }
    public void cbbMaNienkhoa(JComboBox cbb) throws Exception{
        cbb.removeAllItems();
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select maNK from nienKhoa");
        
        while(rs.next()){
            cbb.addItem(rs.getString(1));
        }
    }
    public void cbbNienkhoa(JComboBox cbb) throws Exception{
        cbb.removeAllItems();
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select tenNK from nienKhoa");
        
        while(rs.next()){
            cbb.addItem(rs.getString(1));
        }
    }
    public void cbbNgay(JComboBox cbb){
        cbb.removeAllItems();
        for(int i=1;i<32;i++){
            cbb.addItem(i);
        }        
    }
    public void cbbThang(JComboBox cbb){
        cbb.removeAllItems();
        for(int i=1;i<13;i++){
            cbb.addItem(i);
        }        
    }
    public void cbbNam(JComboBox cbb){
        cbb.removeAllItems();        
        for(int i=2000;i<2050;i++){
            cbb.addItem(i);
        }        
    }
    public void cbbSearch(JComboBox cbb){
        cbb.removeAllItems();
        cbb.addItem("Mã lớp");        
        cbb.addItem("Mã khoa");
        cbb.addItem("Mã niên khóa");
    }    
}
